#include "instructions/constants/ipush.h"

namespace jvm {
namespace instructions {

// Push byte
void BIPUSH::fetchOperands(std::shared_ptr<BytecodeReader> reader)  {
    _val = reader->readInt8();
}

void BIPUSH::execute(std::shared_ptr<rtda::Frame> p_frame)  {
    int32_t i = static_cast<int32_t>(_val);
    p_frame->getOperandStack()->pushInt(i);
}

// Push short
void SIPUSH::fetchOperands(std::shared_ptr<BytecodeReader> reader)  {
    _val = reader->readInt16();
}

void SIPUSH::execute(std::shared_ptr<rtda::Frame> p_frame)  {
    int32_t i = static_cast<int32_t>(_val);
    p_frame->getOperandStack()->pushInt(i);
}

} // namespace instructions
} // namespace jvm


